package com.qaml.mes.device.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qaml.mes.device.dao.EqpCraftTypeDO;
import com.qaml.mes.device.dao.EqpTypeConfigDO;
import com.qaml.mes.device.dao.mapper.EqpCraftConfigMapper;
import com.qaml.mes.device.dao.mapper.EqpTypeConfigMapper;
import com.qaml.mes.device.repository.ConfigRepository;
import com.qaml.mes.device.vo.eqp.EqpCraftConfigVO;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName EqpTypeConfigRepositoryImpl
 * @Description TODO
 * @Author leikai
 * @Date 2024/3/7 0007 11:34
 * @Version 1.0
 */
@Repository
public class ConfigRepositoryImpl implements ConfigRepository {

    @Resource
    private EqpTypeConfigMapper eqpTypeConfigMapper;


    @Resource
    private EqpCraftConfigMapper eqpCraftConfigMapper;

    @Override
    public List<EqpTypeConfigDO> list() {
        return eqpTypeConfigMapper.selectList(new LambdaQueryWrapper<EqpTypeConfigDO>());
    }

    @Override
    public List<EqpCraftTypeDO> craftList() {
        return eqpCraftConfigMapper.selectList(new LambdaQueryWrapper<>());
    }

    @Override
    public EqpCraftTypeDO craftByCraftTypeCode(String craftTypeCode) {
        LambdaQueryWrapper<EqpCraftTypeDO> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(EqpCraftTypeDO::getCraftTypeCode, craftTypeCode);
        return eqpCraftConfigMapper.selectOne(queryWrapper);
    }

}